package com.example.demo.web.controller;

import cn.hutool.core.util.IdUtil;
import com.example.demo.common.dto.UserDTO;
import com.example.demo.web.service.UserService;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yongen
 * @description: 用户操作入口
 * @date 2022/2/9 2:46 PM
 */
@RestController
public class UserController {

  @Resource
  private UserService userService;

  @GetMapping("/saveUser")
  public String testAddUser() {
    // 模拟发送数据
    UserDTO user = new UserDTO(IdUtil.getSnowflakeNextId(), "张三", 25, "浙江杭州");
    userService.saveUser(user);
    return "success";
  }
}
